package org.tgcms.core.dal.appengine.dao;

import org.tgcms.core.dal.appengine.domain.AppengineWebsite;
import org.tgcms.core.dal.dao.DaoException;
import org.tgcms.core.dal.dao.WebsiteDao;
import org.tgcms.core.dal.dto.Website;

public class AppengineWebsiteDao extends
		AppengineEntityDao<AppengineWebsite, Website, Object> implements WebsiteDao {

	public AppengineWebsiteDao() {
		super(AppengineWebsite.class, Website.class);
	}

	// @Override
	// public Website getDefaultWebsite() throws DaoException {
	// List<Website> list = listAll();
	// if(!list.isEmpty()) {
	// return list.get(0);
	// }
	// Website website = new Website();
	// website.setName("Default");
	// website.setUrls(Arrays.asList("default"));
	// put(website);
	//
	// return website;
	// }

	@Override
	protected AppengineWebsite asAppengineEntity(Website website)
			throws DaoException {
		if (website instanceof AppengineWebsite) {
			return (AppengineWebsite) website;
		}
		return new AppengineWebsite(website);
	}

	@Override
	public Website create(Object o) throws DaoException {
		return new AppengineWebsite();
	}

}
